package cn.edu.scau.cmi.dengzhengyu.comprehensiveExperiment;


import cn.edu.scau.cmi.dengzhengyu.client.ConsistentCompositeClient;
import cn.edu.scau.cmi.dengzhengyu.client.SafeCompositeClient;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;


public class ComprehensiveExperimentUIController extends Application{

    @FXML
    private Button ObjectAdapter;

    @FXML
    private Button ClassAdapter;

    @FXML
    private Button ConsistentComposite;

    @FXML
    private Button Singleton;

    @FXML
    private Button Multiton;

    @FXML
    private Button Factory;

    @FXML
    private Button SimpleFactoryMethod;

    @FXML
    private Button SafeComposite;

    @FXML
    private Button AbstractFactory;
    
    private Stage  primaryStage = new Stage();
    
    public void onButtonSingleton()
    {
    	try {
			Stage stage=new Stage();
	       	Parent r = FXMLLoader.load(getClass().getResource("Singleton.fxml"));
	       	Scene s = new Scene(r);
	       	stage.setScene(s);
	       	stage.setResizable(false);
	       	stage.show();
	       	
	           
	   	 } catch(Exception e1) {
	            e1.printStackTrace();
	        }
		
	}
    
  
    
    public void onButtonAbstractFactory()
    {
    	try {
			Stage stage=new Stage();
	       	Parent r = FXMLLoader.load(getClass().getResource("AbstractFactory.fxml"));
	       	Scene s = new Scene(r);
	       	stage.setScene(s);
	       	stage.setResizable(false);
	       	stage.show();
	       	
	           
	   	 } catch(Exception e1) {
	            e1.printStackTrace();
	        }
		
	}
    
    public void onButtonClassAdapter()
    {
    	try {
			Stage stage=new Stage();
	       	Parent r = FXMLLoader.load(getClass().getResource("ClassAdapter.fxml"));
	       	Scene s = new Scene(r);
	       	stage.setScene(s);
	       	stage.setResizable(false);
	       	stage.show();
	       	
	           
	   	 } catch(Exception e1) {
	            e1.printStackTrace();
	        }
		
	}
    
    public void onButtonConsistentComposite() throws Exception
    {
    	ConsistentCompositeClient ccc =  new ConsistentCompositeClient();
    	ccc.start(primaryStage);
	}
    
    
    public void onButtonFactory()
    {
    	try {
			Stage stage=new Stage();
	       	Parent r = FXMLLoader.load(getClass().getResource("Factory.fxml"));
	       	Scene s = new Scene(r);
	       	stage.setScene(s);
	       	stage.setResizable(false);
	       	stage.show();
	       	
	           
	   	 } catch(Exception e1) {
	            e1.printStackTrace();
	        }
		
	}
    
    public void onButtonMultiton()
    {
    	try {
			Stage stage=new Stage();
	       	Parent r = FXMLLoader.load(getClass().getResource("Multiton.fxml"));
	       	Scene s = new Scene(r);
	       	stage.setScene(s);
	       	stage.setResizable(false);
	       	stage.show();
	       	
	           
	   	 } catch(Exception e1) {
	            e1.printStackTrace();
	        }
		
	}
    
    
    public void onButtonObjectAdapter()
    {
    	try {
			Stage stage=new Stage();
	       	Parent r = FXMLLoader.load(getClass().getResource("ObjectAdapter.fxml"));
	       	Scene s = new Scene(r);
	       	stage.setScene(s);
	       	stage.setResizable(false);
	       	stage.show();
	       	
	           
	   	 } catch(Exception e1) {
	            e1.printStackTrace();
	        }
		
	}
    
    public void onButtonSafeComposite() throws Exception
    {
    	SafeCompositeClient scc  = new SafeCompositeClient();
    	scc.start(this.primaryStage);
		
	}
    
    public void onButtonSimpleFactoryMethod()
    {
    	try {
			Stage stage=new Stage();
	       	Parent r = FXMLLoader.load(getClass().getResource("SimpleFactoryMethod.fxml"));
	       	Scene s = new Scene(r);
	       	stage.setScene(s);
	       	stage.setResizable(false);
	       	stage.show();
	       	
	           
	   	 } catch(Exception e1) {
	            e1.printStackTrace();
	        }
		
	}



	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		// TODO Auto-generated method stub
				try {
					Stage stage=new Stage();
			       	Parent r = FXMLLoader.load(getClass().getResource("ComprehensiveExperiment.fxml"));
			       	Scene s = new Scene(r);
			       	stage.setScene(s);
			       	stage.setResizable(false);//设置不能窗口改变大小
			       	stage.show();
			       	
			           
			   	 } 
				catch(Exception e1) {
			            e1.printStackTrace();
			        }
			
			}
			
			 public static void main(String[] args) {
			        launch(args);
			    }
			 
}
